cmake_minimum_required(VERSION 3.12)

#set(PICO_BOARD pico2)  
#set(PICO_PLATFORM rp2350-arm-s)   


# Pull in SDK (must be before project)
include(pico_sdk_import.cmake)
# Pull in FreeRTOS
include(./freertos/FreeRTOS_Kernel_import.cmake)

project(xtrack-pico C CXX ASM)


# Initialize the SDK
pico_sdk_init() 

# Set all global variables here
#set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -Wl,--print-memory-usage")
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -Wl,--print-memory-usage")

#添加头文件目录
#include_directories(driver/lcd)
#include_directories(driver/key)


#添加头文件目录LVG
#include_directories(lvgl)
#include_directories(lvgl/demos)
#include_directories(lvgl/examples/porting)

include_directories(app/Configs)
include_directories(lvgl)
include_directories(./)
#include_directories(freertos/include)
#include_directories(freertos/portable/ThirdParty/GCC/RP2040/include)

add_executable(xtrack-pico
    xtrack-pico.cpp
    porting/display.cpp
) 

# Add pico_stdlib library which aggregates commonly used features

#添加编译子目录
add_subdirectory(driver/lcd)
add_subdirectory(driver/key)
add_subdirectory(hal)
add_subdirectory(lvgl)
add_subdirectory(porting)
add_subdirectory(freertos/portable/ThirdParty/GCC/RP2040)
add_subdirectory(app)
        
target_link_libraries(xtrack-pico  
        APP
        PORTING
        lvgl_examples   
        lvgl      
        FreeRTOS-Kernel 
        FreeRTOS-Kernel-Heap4
        LCD_DRV  
        KEY_DRV
        HAL
        pico_stdlib
        pico_multicore 
        hardware_timer
        hardware_spi
        hardware_i2c
        hardware_pwm
        )

# create map/bin/hex/uf2 file in addition to ELF.
pico_add_extra_outputs(xtrack-pico)

